package cn.itsource.polymorphic1;

import cn.itsource.superdemo2.A;

public class AnimalTest {

	public static void main(String[] args) {
		//人是动物
		Animal person = new Person();//向上造型
		
		//猪是动物
		Animal pig = new Pig();
		
		//之前创建对象方式：
		Person person2 = new Person();
		Pig pig2 = new Pig();
		
		
		//人是猪
//		 Pig person2 = new Person();
		
//		//猪是人
//		Person pig2 = new Pig();
		
		//动物是人
//		Person animal = new Animal();
		
		//动物是猪
//		Pig animal2 = new Animal();
		
		
	}

}
